package com.air.ota.vo;

import com.air.ota.util.ConfigProperties;
import com.air.ota.util.HexStringUtil;

public class UTKDepositResponseDownlinkVO extends UTKBaseDownlinkVO {
	
	protected byte[] cardAppSequence;
	protected byte[] depositSequence;
	protected byte   result;
	protected byte   descLength;
	protected byte[] desc;
	protected byte[] transDate;
	protected byte[] deviceNum;
	protected byte[] mac2;
	
	
	public UTKDepositResponseDownlinkVO(byte[] cardSequence,byte[] pkgSequence,
			byte[] cardAppSequence,byte[] depositSequence,byte result,
			byte[] desc,byte[] transDate,byte[] mac2) {
		super(cardSequence,pkgSequence);
		this.cmdType = 0x11;
		
		this.cardAppSequence = cardAppSequence;
		this.depositSequence = depositSequence;
		this.result = result;
		if (desc==null){
			this.descLength=0;
			this.desc = new byte[0];
		}else{
			this.descLength = (byte)desc.length;
			this.desc = desc;
		}
		this.transDate = transDate;
		this.deviceNum = HexStringUtil.hexStringToBytes(ConfigProperties.getInstance().getValue("szt.terminalNum"));
		this.mac2 = mac2;
		
		String cmdDataHexString=HexStringUtil.bytesToHexString(this.cardAppSequence)+
			HexStringUtil.bytesToHexString(this.depositSequence)+
			HexStringUtil.byteToHexString(this.result)+
			HexStringUtil.byteToHexString(this.descLength);
		
		if (this.descLength>0){
			cmdDataHexString = cmdDataHexString+HexStringUtil.bytesToHexString(this.desc);
		}
		
		cmdDataHexString = cmdDataHexString+
			HexStringUtil.bytesToHexString(this.transDate)+
			HexStringUtil.bytesToHexString(this.deviceNum)+
			HexStringUtil.bytesToHexString(this.mac2)+
			HexStringUtil.bytesToHexString(this.pkgSequence);
		
		this.cmdData = HexStringUtil.hexStringToBytes(cmdDataHexString);
		
	}

}
